"""
@File    ：page_repair_worker.py
@Author  ：ixiaodu
@Date    ：2024/8/20
@Desc    ：
"""
import allure
from common.page_base import Base
from page_element import el_repair_worker
from utils.timer import sleep


class PageRepairWorker(Base):
    """维修工处理页面"""

    def click_agent_task(self):
        """点击代办任务"""
        self.base_click(el_repair_worker.agent_task)
        sleep()

    def click_pending(self):
        """点击待处理"""
        self.base_click(el_repair_worker.pending)
        sleep()

    def click_processing(self):
        """点击处理中"""
        self.base_click(el_repair_worker.processing)
        sleep()

    def click_start_process(self):
        """点击开始处理"""
        self.base_click(el_repair_worker.start_process)
        sleep()

    def click_start_process_confirm(self):
        """点击开始处理确认"""
        self.base_click(el_repair_worker.start_process_confirm)
        sleep()

    def click_repair_detail(self):
        """点击维修详情"""
        self.base_click(el_repair_worker.repair_detail)
        sleep()

    def click_process_feedback(self):
        """点击处理反馈"""
        self.base_click(el_repair_worker.process_feedback)
        sleep()

    def select_toll(self):
        """选择收费"""
        self.base_click(el_repair_worker.toll)
        sleep()

    def input_repair_content(self, content):
        """输入维修内容"""
        self.base_input(el_repair_worker.repair_content, content)
        sleep()

    def click_repair_img(self):
        """点击维修图片"""
        self.base_click(el_repair_worker.repair_img)
        sleep()
        self.processing_image_upload()

    def select_repair_project(self):
        """点击维修项目"""
        self.base_click(el_repair_worker.repair_project)
        sleep()
        self.base_click(el_repair_worker.repair_project_value)
        sleep()

    def click_toll_way(self):
        """点击收费方式"""
        self.base_click(el_repair_worker.toll_way)
        sleep()

    def input_repair_amount(self, amount):
        """输入维修金额"""
        self.base_input(el_repair_worker.repair_amount, amount)
        sleep()

    def click_repair_amount_confirm(self):
        """点击维修金额确认"""
        self.base_click(el_repair_worker.repair_amount_confirm)
        sleep()

    def click_process_feedback_submit(self):
        """点击处理反馈提交"""
        self.base_click(el_repair_worker.process_feedback_submit)
        sleep()

    def click_submit_confirm(self):
        """提交确认"""
        self.base_click(el_repair_worker.submit_confirm)
        sleep()

    def get_response_info(self):
        """获取响应信息"""
        sleep()
        return self.base_get_text(el_repair_worker.response_info)

    def worker_process_repair(self, content, amount):
        """维修工处理报修"""
        with allure.step("点击代办任务"):
            self.click_agent_task()
        with allure.step("点击待处理"):
            self.click_pending()
        with allure.step("点击开始处理"):
            self.click_start_process()
        with allure.step("点击开始处理确认"):
            self.click_start_process_confirm()
        with allure.step("点击处理中"):
            self.click_processing()
        with allure.step("点击维修详情"):
            self.click_repair_detail()
        with allure.step("点击处理反馈"):
            self.click_process_feedback()
        with allure.step("选择收费"):
            self.select_toll()
        with allure.step(f"输入维修内容{content}"):
            self.input_repair_content(content)
        with allure.step("点击维修图片"):
            self.click_repair_img()
        with allure.step("点击维修项目"):
            self.select_repair_project()
        with allure.step("点击收费方式"):
            self.click_toll_way()
        with allure.step(f"输入维修金额{amount}"):
            self.input_repair_amount(amount)
        with allure.step("点击维修金额确认"):
            self.click_repair_amount_confirm()
        with allure.step("点击处理反馈提交"):
            self.click_process_feedback_submit()
        with allure.step("点击提交确认"):
            self.click_submit_confirm()
